package com.caiyigo.baihua.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Repository;

import com.caiyigo.baihua.dto.XueshengDto;
import com.caiyigo.baihua.model.Xuesheng;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;

/**
 * @author Administrator
 * 
 */
@Repository
public class XueshengMapperSql implements XueshengMapper {
	private SqlSessionFactory sqlSessionFactory;

	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory = sqlSessionFactory;
	}

	public List getUserList(XueshengDto user, PageBounds pageBounds) {

		Map<String, Object> params = new HashMap<String, Object>();
		if (null!=user.getId()) {
			params.put(XueshengDto.FileConstant.ID, user.getId());
		}
		if (StringUtils.isNotEmpty(user.getName())) {
			params.put(XueshengDto.FileConstant.NAME, user.getName());
		}
		if (StringUtils.isNotEmpty(user.getStatus())) {
			params.put(XueshengDto.FileConstant.STATUS, user.getStatus());
		}
		if (StringUtils.isNotEmpty(user.getZkz())) {
			params.put(XueshengDto.FileConstant.zkz, user.getZkz());
		}
		if (StringUtils.isNotEmpty(user.getSfz())) {
			params.put(XueshengDto.FileConstant.sfz, user.getSfz());
		}
		if (StringUtils.isNotEmpty(user.getSshm())) {
			params.put(XueshengDto.FileConstant.sshm, user.getSshm());
		}
		if (StringUtils.isNotEmpty(user.getZyId())) {
			params.put(XueshengDto.FileConstant.zyId, user.getZyId());
		}
		if (StringUtils.isNotEmpty(user.getMobile())) {
			params.put(XueshengDto.FileConstant.mobile, user.getMobile());
		}
		if (StringUtils.isNotEmpty(user.getSchool())) {
			params.put(XueshengDto.FileConstant.school, user.getSchool());
		}
		List<Object> list = null;
		SqlSession session = sqlSessionFactory.openSession();
		try {
			list = session.selectList(
					"com.caiyigo.baihua.dao.XueshengMapper.list", params,
					pageBounds);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}

		return list;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#deleteByPrimaryKey(java.lang.Integer)
	 */
	@Override
	public int deleteByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#insert(com.caiyigo.zoo.model.Xuesheng)
	 */
	@Override
	public int insert(Xuesheng record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#insertSelective(com.caiyigo.zoo.model
	 * .Xuesheng)
	 */
	@Override
	public int insertSelective(Xuesheng record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#selectByPrimaryKey(java.lang.Integer)
	 */
	@Override
	public Xuesheng selectByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#updateByPrimaryKeySelective(com.caiyigo
	 * .zoo.model.Xuesheng)
	 */
	@Override
	public int updateByPrimaryKeySelective(Xuesheng record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.XueshengMapper#updateByPrimaryKey(com.caiyigo.zoo
	 * .model.Xuesheng)
	 */
	@Override
	public int updateByPrimaryKey(Xuesheng record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.XueshengMapper#batchDelete(java.lang.String[])
	 */
	@Override
	public int batchDelete(String[] ids) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.XueshengMapper#getAll()
	 */
	@Override
	public List<Xuesheng> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.XueshengMapper#batchUpdate(java.util.List)
	 */
	@Override
	public int batchUpdate(List<Xuesheng> record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<Xuesheng> getXueshengForZWCJ(Map<String, String>params) {
		// TODO Auto-generated method stub
		return null;
	}

}
